package vodka.interpreter;

import java.io.*;

/**
 *	Templates for Java-method wrappers with different signatures.
 */

public class NativeHookTemplate extends NativeHook
{
	public Object invokeCons0(Object[] args)
	{
		return new NativeTemplate();
	}

	public Object invokeCons1(Object[] args)
	{
		return new NativeTemplate((NativeTemplate)args[0]);
	}

	public Object invokeCons2(Object[] args)
	{
		return new NativeTemplate((NativeTemplate)args[0], (NativeTemplate)args[1]);
	}

	public Object invokeVirtual0(Object[] args)
	{
		NativeTemplate target = (NativeTemplate)args[0];
		
		return target.methodVirtual0();
	}

	public Object invokeVirtual1(Object[] args)
	{
		NativeTemplate target = (NativeTemplate)args[0];
		
		return target.methodVirtual1((NativeTemplate)args[1]);
	}

	public Object invokeVirtual2(Object[] args)
	{
		NativeTemplate target = (NativeTemplate)args[0];
		
		return target.methodVirtual2((NativeTemplate)args[1], (NativeTemplate)args[2]);
	}

	public Object invokeVoidStatic0(Object[] args)
	{
		NativeTemplate.methodVoidStatic0();
		return unit;
	}

	public Object invokeStatic0(Object[] args)
	{
		return NativeTemplate.methodStatic0();
	}

	public Object invokeStatic1(Object[] args)
	{
		return NativeTemplate.methodStatic1((NativeTemplate)args[0]);
	}
	
	public Object invokeStatic2(Object[] args)
	{
		return NativeTemplate.methodStatic2((NativeTemplate)args[0], (NativeTemplate)args[1]);
	}
	
	public Object invokeBasicStatic2(Object[] args)
	{
		return new Float(NativeTemplate.methodBasicStatic2(((Integer)args[0]).intValue(), ((Boolean)args[1]).booleanValue()));
	}
	
	public Object invokeArrayStatic2(Object[] args)
	{
		return NativeTemplate.methodArrayStatic2((int[])args[0], (String[])args[1]);
	}
}